var mongoose = require('mongoose'),
    uuidv4 = require('uuid/v4'),
    Schema = mongoose.Schema;

var foodTypeSchema = new Schema({
    _id: {type:String},
    name: {type:String}
}, {
    collection: 'foodType'
});

// foodTypeSchema.index({name: 1}, {unique: true});



// Auto update last update time
foodTypeSchema.pre('update', function () {

});

foodTypeSchema.pre('save', function (next) {
    var foodType = this;
    foodType._id = uuidv4();
    next();
});

mongoose.model('FoodType', foodTypeSchema);